package com.woniuxy.lrz.carlproject.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.lrz.carlproject.model.OrderInfo;
import com.woniuxy.lrz.carlproject.dao.OrderInfoMapper;
import com.woniuxy.lrz.carlproject.service.OrderInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.lrz.carlproject.service.dto.orderDto.OrderInfoDto;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 订单详情表 服务实现类
 * </p>
 *
 * @author lrz
 * @since 2022-09-28
 */
@Service
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements OrderInfoService {

    @Resource
    private OrderInfoMapper orderInfoMapper;
    @Override
    @Cacheable(cacheNames = "OrderInfo", key = "#orderId")
    public List<OrderInfo> getOrderInfoById(int orderId) {
        QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
        wrapper.eq("user_order_id",orderId);
        List<OrderInfo> orderInfos = orderInfoMapper.selectList(wrapper);
        return orderInfos;
    }
}
